<?php


/*

	Copyright © 2011 Mike Bennett <mike@kereru.com>

	This file is part of Tazu-Time.

    Tazu-Time is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    any later version.

    Tazu-Time is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Tazu-Time.  If not, see <http://www.gnu.org/licenses/>.
    
*/


define("APPSHORTNAME", 'Tazu-Timesheets Manager');
define("VER", '5.0');
define("APPNAME", APPSHORTNAME);		// Must set caption on main window to the same
define("WINDOW_ICON",'app_icon.png');


define("PATH_SCRIPT",   dirname(__FILE__) . "/");
define("PATH_DATA",     PATH_SCRIPT);
	
	
// Common/shared code
if ( strrev(substr(strrev(dirname(__FILE__)),0,3)) == 'src' ) {
	define("PATH_INC",      "./include/");
	define("PATH_COM",      "../../../../common/include/");
//	define("PATH_RES",      "../../../../common/resources/");
	define("PATH_RES",      "./resources/");
	define("DEVELOPMENT",	TRUE);
}
else {
	define("PATH_INC",      "./");
	define("PATH_COM",      "./");
	define("PATH_RES",      "./resources/");
	define("DEVELOPMENT",	FALSE);
}

if ( file_exists(PATH_INC."4A527F83A3A4CA7E1D70ADB26A35B72E.rdc")) {
	include(PATH_INC."4A527F83A3A4CA7E1D70ADB26A35B72E.rdc");
}
elseif ( file_exists(PATH_INC."loader.rdc")) {
	include(PATH_INC."loader.rdc");
}
else {
	include(PATH_INC."loader.php");
}
	

if ( DEVELOPMENT ) {
	// Additional benchmark timer code.
//	include_once(exe_resource(PATH_INC."timer.php"));

//	$GLOBALS['timer'] = new Benchmark_Timer();
/*
	if ( DEVELOPMENT ) $GLOBALS['timer']->start();
	$GLOBALS['timer']->setMarker('_construct');
	$GLOBALS['timer']->setMarker('ls');
	$GLOBALS['timer']->stop();
	$GLOBALS['timer']->display();
*/

}	
	
	
//----------------------------------------------------------------- VERSION AND BUILD
include(exe_resource(PATH_INC."build_manager.inc.php"));
define("VERSION", VER.'.'.BUILD);
	
//-------------------------------------------------------------------- CONSTANTS
	
	
//----------------------------------------------------------------- FUNCTIONS
	



//----------------------------------------------------------------- DEPENDENCIES


//----------------------------------------------------------- CLASS DECLARATIONS


//include_once(exe_resource(PATH_INC.'dlg_splash.class.php'));
//$GLOBALS['splash'] = new dlg_splash;

//if ( DEVELOPMENT ) $GLOBALS['timer']->setMarker('Start');

include_once(exe_resource(PATH_COM.'WindowsRegistry.class.php'));
include_once(exe_resource(PATH_COM.'platform.class.php'));
include_once(exe_resource(PATH_COM.'conf.class.php'));
include_once(exe_resource(PATH_COM.'file_chooser.class.php'));

include_once(exe_resource(PATH_INC.'db.class.php'));
include_once(exe_resource(PATH_INC.'customers.class.php'));
include_once(exe_resource(PATH_INC.'reports.class.php'));
include_once(exe_resource(PATH_INC.'ts_sqlite3_pdo.inc.php'));
include_once(exe_resource(PATH_INC.'workers.class.php'));
include_once(exe_resource(PATH_INC.'conf_timesheet.class.php'));
include_once(exe_resource(PATH_INC.'settings.class.php'));
include_once(exe_resource(PATH_INC.'control_base.class.php'));
include_once(exe_resource(PATH_INC.'control.class.php'));
include_once(exe_resource(PATH_INC.'control_blue.class.php'));
include_once(exe_resource(PATH_INC.'customer_grid.class.php'));
include_once(exe_resource(PATH_INC.'project_grid.class.php'));
include_once(exe_resource(PATH_INC.'worker_grid.class.php'));
include_once(exe_resource(PATH_INC.'field_grid.class.php'));
include_once(exe_resource(PATH_INC.'xlate_grid.class.php'));
include_once(exe_resource(PATH_INC.'edit_customer.class.php'));
include_once(exe_resource(PATH_INC.'edit_project.class.php'));
include_once(exe_resource(PATH_INC.'edit_worker.class.php'));
include_once(exe_resource(PATH_INC.'edit_field.class.php'));
include_once(exe_resource(PATH_INC.'edit_xlate.class.php'));
include_once(exe_resource(PATH_INC.'win_timesheet.class.php'));
include_once(exe_resource(PATH_INC.'manager.win.php'));

/*
include_once(exe_resource(PATH_INC.'wizard.class.php'));



//platform::exec('thread_1.exe');								// start background thread ASAP
//platform::exec('thread_2.exe');								// start background thread ASAP

include_once(exe_resource(PATH_INC."thread.class.php"));
include_once(exe_resource(PATH_INC."control.class.php"));
include_once(exe_resource(PATH_INC."dms_client.class.php"));
include_once(exe_resource(PATH_INC."ipc.class.php"));
include_once(exe_resource(PATH_INC."capture.class.php"));
include_once(exe_resource(PATH_INC."bingo.class.php"));
include_once(exe_resource(PATH_INC."ipc.class.php"));
include_once(exe_resource(PATH_INC."GD2.class.php"));
include_once(exe_resource(PATH_INC."pdf.class.php"));
include_once(exe_resource(PATH_INC."scanner.class.php"));
include_once(exe_resource(PATH_INC."bingo.class.php"));
include_once(exe_resource(PATH_INC.'dlg_briefcase.class.php'));
include_once(exe_resource(PATH_INC.'dlg_docstore.class.php'));
include_once(exe_resource(PATH_INC.'file_chooser.class.php'));

include_once(exe_resource(PATH_INC.'docstore.win.php'));
include_once(exe_resource(PATH_INC.'add_file.win.php'));
include_once(exe_resource(PATH_INC.'add_file_wizard.win.php'));
include_once(exe_resource(PATH_INC.'search.win.php'));
include_once(exe_resource(PATH_INC.'scanner.win.php'));
//include_once(exe_resource(PATH_INC.'config.win.php'));
//include_once(exe_resource(PATH_INC.'license.win.php'));
//include_once(exe_resource(PATH_INC.'utils.win.php'));
include_once(exe_resource(PATH_INC.'logview.win.php'));
include_once(exe_resource(PATH_INC.'file_chooser.class.php'));
include_once(exe_resource(PATH_INC.'file_saveas.class.php'));
include_once(exe_resource(PATH_INC.'WindowsRegistry.class.php'));
*/

//if ( DEVELOPMENT ) $GLOBALS['timer']->setMarker('Includes loaded');


// Close splash window
//$splash->close();


//-------------------------------------------------------------- EXECUTABLE CODE


// Handlers and functionality
$handlers = new manager_win;	// Handlers and functionality

// window display
$glade = new GladeXML(PATH_RES.'manager.glade','manager');
$glade->signal_autoconnect_instance($handlers);

//if ( DEVELOPMENT ) $GLOBALS['timer']->setMarker('Glade Loaded');

$handlers->glade = $glade;
$handlers->win = $glade->get_widget('manager');
$handlers->open();	// initialise, populate and setup of app

//if ( DEVELOPMENT ) $GLOBALS['timer']->setMarker('Main Start');
//if ( DEVELOPMENT ) $GLOBALS['timer']->stop();
//if ( DEVELOPMENT ) $GLOBALS['timer']->display();


// main loop
Gtk::main();
//------------------------------------------------------------------ END OF FILE


?>

